﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;

namespace Smile_Printers
{
    public partial class getImage : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            //TODO: error checking for query string

            if (Session["dsPhotoFiles"] != null)
            {
                DataSet tmpDs = new DataSet();
                tmpDs = (DataSet)Session["dsPhotoFiles"];

                for (int i = 0; i < tmpDs.Tables[0].Rows.Count; i++)
                {
                    if (tmpDs.Tables[0].Rows[i]["id"].ToString() == Request.QueryString["id"])
                    {
                        Response.BinaryWrite((byte[])(tmpDs.Tables[0].Rows[i]["fileBytes"]));
                        break;
                    }
                }
            }
        }
    }
}
